package com.jyy.prefabricated.service.impl;

import com.jyy.prefabricated.entity.StudentSignUpApplyPhoto;
import com.jyy.prefabricated.mapper.StudentSignUpApplyPhotoMapper;
import com.jyy.prefabricated.service.StudentSignUpApplyPhotoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 学生报名照片关联表(StudentSignUpApplyPhoto)表服务实现类
 *
 * @author makejava
 * @since 2021-06-29 16:40:13
 */
@Service("studentSignUpApplyPhotoService")
public class StudentSignUpApplyPhotoServiceImpl implements StudentSignUpApplyPhotoService {
    @Resource
    private StudentSignUpApplyPhotoMapper studentSignUpApplyPhotoMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public StudentSignUpApplyPhoto queryById(Integer id) {
        return this.studentSignUpApplyPhotoMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<StudentSignUpApplyPhoto> queryAllByLimit(int offset, int limit) {
        return this.studentSignUpApplyPhotoMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param studentSignUpApplyPhoto 实例对象
     * @return 实例对象
     */
    @Override
    public StudentSignUpApplyPhoto insert(StudentSignUpApplyPhoto studentSignUpApplyPhoto) {
        this.studentSignUpApplyPhotoMapper.insert(studentSignUpApplyPhoto);
        return studentSignUpApplyPhoto;
    }

    /**
     * 修改数据
     *
     * @param studentSignUpApplyPhoto 实例对象
     * @return 实例对象
     */
    @Override
    public StudentSignUpApplyPhoto update(StudentSignUpApplyPhoto studentSignUpApplyPhoto) {
        this.studentSignUpApplyPhotoMapper.update(studentSignUpApplyPhoto);
        return this.queryById(studentSignUpApplyPhoto.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.studentSignUpApplyPhotoMapper.deleteById(id) > 0;
    }
}
